package Test.IO;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class CopyFile02 {
    public static void main(String[] args) {
        FileReader in=null;
        FileWriter out= null;

        try {
            in=new FileReader("/Users/jinnian/Desktop/emp.txt");

            out=new FileWriter("/Users/jinnian/Desktop/emp2.txt");
            char[] ch=new char[2048];
            int len=0;
            while ((len=in.read(ch))!=-1){
                out.write(ch,0,len);

            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (in!=null){
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if(out!=null){
                    try {
                        out.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }

        }


    }
}
